package mtatestapp;
import com.google.wave.api.*;

public class MtatestappServlet extends AbstractRobotServlet {
	
	@Override
	public void processEvents(RobotMessageBundle bundle) {
		Wavelet wavelet = bundle.getWavelet();
		
		if (bundle.wasSelfAdded()) {
			Blip blip = wavelet.appendBlip();
			TextView textview = blip.getDocument();
			textview.append("I'm alive");
			wavelet.setTitle("This is a new title");
		}
		
		for (Event e: bundle.getEvents()) {
			if (e.getType() == EventType.WAVELET_PARTICIPANTS_CHANGED) {
				Blip blip = wavelet.appendBlip();
				TextView textview = blip.getDocument();
				textview.append("Hi everybody");
				
			}
			if (e.getType() ==EventType.FORM_BUTTON_CLICKED) {
				Blip blip = wavelet.appendBlip();
				TextView textview = blip.getDocument();
				textview.append("Something was changed");
			}
		}
	}
}